/*!
 * \file nuExecute.cpp
 * \brief Executing object.
 * \author Nus
 * \date 2008/02/17, 01:27
 */

#include "nuExecute.h"
#include "nuExecMgr.h"

BEGIN_RTTI_IMPL_NO_INST(nuExecute);
  RTTI_IMPL(nuExecute, nuObject);
END_RTTI_IMPL_NO_INST(nuExecute);

// Default constructor.
nuExecute::nuExecute(u32 priority)
    : mpNext(NULL),
      mpPrev(NULL),
      mExecutePriority(-1)
{
  nuExecMgr* mgr = INST(nuExecMgr);
  if(mgr) {
    s32 err = mgr->addExecObj(this, priority);
    ASSERT_C(err == EC_NONE);
  }
}

// Default destructor.
nuExecute::~nuExecute()
{
  nuExecMgr* mgr = INST(nuExecMgr);
  if(mgr) {
    s32 err = mgr->removeExecObj(this);
    ASSERT_C(err == EC_NONE);
  }
}
